package string.nowcoder.easy;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author bruin_du
 * @description mkdir
 * https://www.nowcoder.com/questionTerminal/433c0c6a1e604a4795291d9cd7a60c7a
 * @date 2022/6/28 18:59
 **/
public class mkdir {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextLine()) {
            int n = in.nextInt();
            in.nextLine();
            String[] strings = new String[n];
            for (int i = 0; i < n; i++) {
                strings[i] = in.nextLine();
            }
            Arrays.sort(strings);
            String prev = strings[0];
            for (int i = 1; i < n; i++) {
                if (!strings[i].contains(prev) ||//字符串无包含关系
                        //走到这,说明字符串有包含关系
                        (prev.length() < strings[i].length() &&//如果字符串相等跳出if
                        strings[i].charAt(prev.length()) != '/')) {
                    System.out.println("mkdir -p " + prev);
                }
                prev = strings[i];
            }
            System.out.println("mkdir -p " + strings[n - 1]);
            System.out.println();
        }
    }
}
